package de.dailab.graphworld.ontology;

import de.dailab.jiactng.agentcore.knowledge.IFact;

public class Edge implements IFact{
	
	private static final long serialVersionUID = 6397388642684409297L;
	
	// an edge knows only its target node, its weight and its pheromones
	private Node target;
	private int weight;
	private Pheromone pheromone;
	
	public Edge(int weight, Node target){
		this.weight = weight;
		this.target = target;
		this.pheromone = new Pheromone();
	}
	
	public Edge(int weight, Node target, double pheromoneDecay) {
		this.weight = weight;
		this.target = target;
		this.pheromone = new Pheromone(pheromoneDecay);
	}

	public int getWeight() {
		return weight;
	}

	public Node getTarget() {
		return target;
	}
	
	@Override
	public String toString(){
//		return "target: "+target.getID()+", weight: "+weight;
		return " -> "+target.getID();
	}
	
	@Override
	public boolean equals(Object o){
		if(o instanceof Edge){
			return(this.target.equals(((Edge)o).target) && this.weight == ((Edge)o).weight);
		}
		return false;
	}

	public Pheromone getPheromone() {
		return pheromone;
	}

	public void setPheromone(Pheromone pheromone) {
		this.pheromone = pheromone;
	}
	
	public void dropHomePheromone(String teamName){
		pheromone.addHomePheromone(teamName, 1);
	}
	
	public void dropGoldPheromone(String teamName){
		pheromone.addGoldPheromone(teamName, 1);
	}
	
}
